// LongSquare.c
#include <avr/io.h>
#include <util/delay.h>
int main (void)
{
	DDRD = 0xFF;		//set PORTD for output
	PORTD = 0;		//stop both motors
	
	for (int i = 1; i <= 10; i = i +1) 		//Pause to let get out of the way
	{
		_delay_loop_2(30000);
	}
	
		//** FORWARD 1**
	
	PORTD = 3;									//Both Motor Forward	
	for (int i = 1; i <= 10; i = i +1)
	{
		_delay_loop_2(30000);
	
	
		//**TURN 1**
	
	PORTD = 1;									//One Motor to Turn 90 degree corner
	for (int i = 1; i <= 7; i = i +1)
	{
		_delay_loop_2(27000);
	}
	PORTD = 0;									//Stop Turn
	
		//**FORWARD 2**
	
	PORTD = 3;
	for (int i = 1; i <= 10; i = i +1)
	{
		_delay_loop_2(30000);
	}
	
		//**TURN 2**
	
	PORTD = 1;
	for (int i = 1; i <= 7; i = i +1)
	{
		_delay_loop_2(27000);
	}
	PORTD = 0;
	
		//**FORWARD 3**
	
	PORTD = 3;
	for (int i = 1; i <= 10; i = i +1)
	{
		_delay_loop_2(30000);
	}	

	
		//**TURN 3
	
	PORTD = 1;
	for (int i = 1; i <= 7; i = i +1)
	{
		_delay_loop_2(27000);
	}
	PORTD = 0;
	
		//**FORWARD 4**
	
	PORTD = 3;
	for (int i = 1; i <= 10; i = i +1)
	{
		_delay_loop_2(30000);
	}
	
		//**TURN 4 Final
	
	PORTD = 1;
	for (int i = 1; i <= 7; i = i +1)
	PORTD = 1;
	{
		_delay_loop_2(27000);
	}
	PORTD = 0;
	}
}



